package com.example.many_ds.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.many_ds.mapper.UserMapper;
import com.example.many_ds.model.User;
import com.example.many_ds.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName UserServiceImpl
 * @Description
 * @Author zhangsw
 * @Date 2021/1/10 20:15
 * @Version 1.0
 */
@Service
public class UserServiceImpl implements IUserService {

    @Resource
    UserMapper userMapper;

    @DS("slave")
    public List<User> getAllUser() {
        return userMapper.getAllUser();
    }

    @DS("master")
    public Integer addUser(User user) {
        return userMapper.addUser(user);
    }
}
